<!DOCTYPE html>
<html ng-app="myApp" lang="en">
<head>
	<meta charset="UTF-8" />
	<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css">
	<script src="https://cdn.bootcss.com/angular.js/1.5.8/angular.js"></script>
  <script src="https://cdn.bootcss.com/jquery/1.12.1/jquery.min.js"></script>
  <script type="text/javascript">

		// $(document).ready(function(){
  // 				$("button").click(function(){
  // 					var bookname = $("#test").val();
  //   				$.ajax({
  //   					url:"https://api.douban.com/v2/book/search?q=" + bookname,
  //   					type: 'GET',
  //       				dataType: 'JSONP',
  //   					success:function(result){
  //   						$("#outp").empty();
  //   						var wxhead = "<thead><tr><th>title</th><th>author</th></tr></thead>";
  //   						$("#outp").append(wxhead);
  //           				for(var i in result.books) {
  //           						var tit =  result.books[i].title;

  //           						var auts =  result.books[i].author;
  //               				$("#outp").append("<tr><td>"+tit+"</td><td>"+auts+"</td></tr>");//循环输出a:1,b:2,etc.
  //           				}
  //   					},
  //   					timeout:3000
  // 					});
		// 		});
		// });
   <!--var app = angular.module('myApp', []);-->
   <!--app.controller('customersCtrl', function($scope, $http) {-->
    <!--$scope.firstName = "ddd";-->
    <!--$scope.req = function(){-->
      <!--$http.get("/search/" + $scope.booknames)-->
      <!--.success(function(response) {-->
        <!--console.log(response);-->
        <!--var abc = response.count;-->
        <!--console.log(abc);-->
        <!--$scope.hihi = angular.copy(abc);-->
        <!--console.log($scope.hihi);-->

        <!--});-->
      <!--};-->
      <!--});-->
    </script>

    <script type="text/javascript">
      var app = angular.module('myApp', []);
      app.controller('customersCtrl', function($scope, $http) {
        $scope.firstName = "ddd";
        $scope.req = function(){
          $http.get("/search/" + $scope.booknames)
          .success(function(response) {
            console.log(response);
            var abc = response.count;
            console.log(abc);
            $scope.hihi = angular.copy(abc);
            $scope.books = response.books;
            console.log($scope.hihi);
          });
        };
      });



    </script>
    <meta charset="UTF-8">
    <title>	Search books</title>
  </head>
  <body>
    <div ng-controller="customersCtrl">
      <p>book name：<input ng-model="booknames" type="input" id="test" class="input-group" /></p>
      <button ng-click="req()" type="button" class="btn btn-default">Search</button>
      {% raw %}
      <p  ng-model="hihi" >
       {{ hihi }}
     </p>

     <table>
     <tr ng-repeat="x in books">
        <td>{{ x.title }}</td>
        <td>{{ x.subtitle }}</td>
      </tr>
    </table>

    {% endraw %}
  </div>


  <script src="https://cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</body>
</html>